package br.odb.libstrip;

import java.util.ArrayList;

import br.odb.libscene.Color;
import br.odb.libscene.Material;
import br.odb.utils.math.Vec3;

public class GeneralPolygon implements IndexedSetFace {
	
	private boolean visible = true;
	private ArrayList<Integer> indexes = new ArrayList<Integer>();
	private ArrayList<Vec3> vertexes = new ArrayList<Vec3>();
	private Color color;
	private Material material;
	
	/**
	 * @return the material
	 */
	public final Material getMaterial() {
		return material;
	}


	/**
	 * @param material the material to set
	 */
	public final void setMaterial(Material material) {
		this.material = material;
	}


	public void setVisibility(boolean visibility) {
		visible  = visibility;
	}

	
	public boolean getVisibility() {

		return visible;
	}

	
	public IndexedSetFace makeCopy() {

		GeneralPolygon poly = new GeneralPolygon();
		
		for ( int c = 0; c < getTotalIndexes(); ++c )
			poly.addIndex( getIndex( c ) );
		
		return poly;
	}


	public int getTotalIndexes() {

		return indexes.size();
	}

	
	public int getIndex(int d) {

		return indexes.get( d ).intValue();
	}

	
	public void addIndex(int index) {

		indexes.add( Integer.valueOf( index ) );
	}

	
	public Vec3 getVertex(int c) {

		return vertexes.get( c );
	}

	
	public void addVertex(Vec3 v) {

		vertexes.add( v );		
	}

	
	public Color getColor() {

		return color;
	}

	
	public void setColor(Color c) {
		
		color = c;		
	}

}
